home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / vpi1_330.zip / SAMPLES.PRG < prev    next >
Text File  |  1992-01-09  |  11KB  |  342 lines

  1. *************************************************************************
  2. **  SAMPLES.PRG
  3. **  (C) Copyright 1990-92, Sub Rosa Publishing Inc.
  4. **
  5. **  A demonstration program provided to VP-Info users.
  6. **  This program may be copied freely. If it is used in commercial code,
  7. **  please credit the source, Sub Rosa Publishing Inc.
  8. **
  9. **  SAMPLES demonstrates the use of the MENU( function and calls a number
  10. **  of Info demonstration programs.
  11. **
  12. **  SAMPLES is compatible with all current versions of VP-Info.
  13. **
  14. **  SAMPLES displays a menu, determines the choice made, and takes
  15. **  action depending both on the selection and the key used to make
  16. **  the selection.
  17. **
  18. **  SAMPLES is the driver program for the INFO collection of sample
  19. **  programs. As such it is a complex program included more for the
  20. **  work it does than than the instruction is provides.
  21. **
  22. **  Sid Bursten and Bernie Melman
  23. ***************************************************************************
  24. SET library to samples
  25. SET talk off                  ;suppress VP-Info messages during programs
  26. SET echo off                  ;do not display program during compilation
  27. :serial=:color  ; save to restore on way out
  28. IF :color=7     ; when original color=7, means we're monochrome
  29. ELSE
  30.    :color=62    ; we must be in color
  31. ENDIF
  32. progname='MENU1'
  33. SET text on
  34. expnum=1
  35. codnum=2
  36. ON escape
  37.    CURSOR 22,0
  38.    CANCEL
  39. ENDON
  40. DO WHILE t                    ;put main menu in an infinite loop
  41.    WINDOW                     ;cancel any pre-existing window
  42.    ERASE                      ;fills window with blanks
  43.    CLEAR gets
  44.    WINDOW 5,22                ;start entry on row 5
  45.    TEXT
  46.   ╒═════════════════════════════════════════════════════════════════════════╕
  47.   │   Use the Up Arrow and Down Arrow to "highlight" the option you want    │
  48.   │   and press ENTER to activate that choice, or press a number from 0-6   │
  49.   │   to activate that choice immediately.                                  │
  50.   │                                                                         │
  51.   │                      SAMPLE PROGRAMS MENU                               │
  52.   │                                                                         │
  53.   │                  0. Exit to Conversational VP-Info                      │
  54.   │                                                                         │
  55.   │                  1. Introductory Programs                               │
  56.   │                  2. Intermediate Programs                               │
  57.   │                  3. Advanced Programs                                   │
  58.   │                  4. VP-Info Features Demonstration                      │
  59.   │                  5. Programs that will work for you now                 │
  60.   │                  6. Register your VP-Info                               │
  61.   │                                                                         │
  62.   ╘═════════════════════════════════════════════════════════════════════════╛
  63.    ENDTEXT
  64.    WINDOW
  65.    CURSOR 14,20 ; positions menu cursor over 1st character of 1st choice
  66.    group=menu(6,40)      ;six choices menu bar width 40
  67.    DO CASE
  68.    CASE group=0  .or. :key=327  ; <home> key
  69.       :color=:serial      ;restore color
  70.       CLS                 ;clear screen 
  71.       CANCEL
  72.    CASE group=4
  73.       CHAIN demo
  74. *   CASE group=5
  75. *      CHAIN workers
  76.    CASE group=6
  77.       CHAIN register
  78.    CASE group=1
  79.       WINDOW 5,23                ;start entry on row 5
  80.       TEXT
  81.                      INTRODUCTORY PROGRAMS
  82.  
  83.                      0. Exit to the Main Samples Menu
  84.  
  85.                      1. Simple Menu Program
  86.                      2. Better Menu Program
  87.                      3. Edit/Browse Demonstration
  88.                      4. Data Validation through ON FIELD
  89.                      5. Sample List-Maintenance Program
  90.                      6. Memo Field Support
  91.  
  92.                 Use the Up Arrow and Down Arrow to
  93.                 "highlight" the option you want and
  94.                 press ENTER to activate that choice, or
  95.                 press a number from 0-4 (zero through four)
  96.                 to activate that choice immediately.
  97.       ENDTEXT
  98.       WINDOW
  99.       CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
  100.       ans=menu(6,40)      ;four choices menu bar width 40
  101.       DO CASE
  102.       CASE ans=1
  103.          progname='MENU1'
  104.          expnum=77
  105.          codnum=80
  106.       CASE ans=2
  107.          progname='MENU2'
  108.          expnum=1
  109.          codnum=2
  110.       CASE ans=3
  111.          progname='EDBROW'
  112.          expnum=3
  113.          codnum=4
  114.       CASE ans=4
  115.          progname='ONFIELD'
  116.          expnum=5
  117.          codnum=6
  118.       CASE ans=5
  119.          progname='MEMBERS'
  120.          expnum=7
  121.          codnum=8
  122.       CASE ans=6
  123.          progname='MEMODEMO'
  124.          expnum=155
  125.          codnum=156
  126.       ENDCASE
  127.       IF ans>0
  128.          PERFORM options
  129.       ENDIF
  130.    CASE group=2
  131.       WINDOW 5,23                ;start entry on row 5
  132.       TEXT
  133.                   INTERMEDIATE SAMPLES PROGRAMS
  134.  
  135.                      0. Exit to the Main Samples Menu
  136.  
  137.                      1. Create Logon Screen in Program
  138.                      2. Use Various Info Date Formats
  139.                      3. Set Up Relation Between Files
  140.                      4. Use the APPEND FROM Command
  141.                      5. Simple 1-Across Label Program
  142.                      6. Sound and Screen Special Effects
  143.  
  144.                 Use the Up Arrow and Down Arrow to
  145.                 "highlight" the option you want and
  146.                 press ENTER to activate that choice, or
  147.                 press a number from 0-6 (zero through six)
  148.                 to activate that choice immediately.
  149.       ENDTEXT
  150.       WINDOW
  151.       CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
  152.       ans=menu(6,40)      ;five choices menu bar width 40
  153.       DO CASE
  154.       CASE ans=1
  155.          progname='SRILOGON'
  156.          expnum=9
  157.          codnum=10
  158.       CASE ans=2
  159.          progname='DATES'
  160.          expnum=13
  161.          codnum=14
  162.       CASE ans=3
  163.          progname='RELATION'
  164.          expnum=15
  165.          codnum=16
  166.       CASE ans=4
  167.          progname='APPFROM'
  168.          expnum=17
  169.          codnum=18
  170.       CASE ans=5
  171.          progname='ONELABEL'
  172.          expnum=19
  173.          codnum=20
  174.       CASE ans=6
  175.          progname='EFFECTS'
  176.          expnum=11
  177.          codnum=12
  178.       ENDCASE
  179.       IF ans>0
  180.          PERFORM options
  181.       ENDIF
  182.    CASE group=3
  183.       WINDOW 5,23                ;start entry on row 5
  184.       TEXT
  185.                     ADVANCED SAMPLES PROGRAMS
  186.  
  187.                      0. Exit to the Main Samples Menu
  188.  
  189.                      1. Access Fields by Number, Not Name
  190.                      2. Use Program to modify ASCII File
  191.                      3. Use "Bit Arithmetic" in Info
  192.                      4. A Complex Label Generator
  193.  
  194.                 Use the Up Arrow and Down Arrow to
  195.                 "highlight" the option you want and
  196.                 press ENTER to activate that choice, or
  197.                 press a number from 0-4 (zero through four)
  198.                 to activate that choice immediately.
  199.       ENDTEXT
  200.       WINDOW
  201.       CURSOR 9,20 ; positions menu cursor over 1st character of 1st choice
  202.       ans=menu(4,40)      ;four choices menu bar width 40
  203.       DO CASE
  204.       CASE ans=1
  205.          progname='VECTOR'
  206.          expnum=21
  207.          codnum=22
  208.       CASE ans=2
  209.          progname='FILTERCR'
  210.          expnum=23
  211.          codnum=24
  212.       CASE ans=3
  213.          progname='BIT'
  214.          expnum=25
  215.          codnum=26
  216.       CASE ans=4
  217.          progname='LAB_GEN'
  218.          expnum=27
  219.          codnum=28
  220.       ENDCASE
  221.       IF ans>0
  222.          PERFORM options
  223.       ENDIF
  224.    CASE group=5
  225.       WINDOW 5,23                ;start entry on row 5
  226.       TEXT
  227.     A number of programs in the sample collection are useful as well
  228.     as instructional. The List Maintenace and Label Generator
  229.     Can be accessed from other menus.
  230.  
  231.                        Some Programs to Use NOW!
  232.  
  233.                      0. Exit to the Main Samples Menu
  234.  
  235.                      1. A menu with screen saver
  236.                      2. List-Maintenance Program
  237.                      3. Labels from any data base
  238.  
  239.                 Use the Up Arrow and Down Arrow to
  240.                 "highlight" the option you want and
  241.                 press ENTER to activate that choice, or
  242.                 press a number from 0-3 to activate
  243.                 that choice immediately.
  244.       ENDTEXT
  245.       WINDOW
  246.       CURSOR 13,20 ; positions menu cursor over 1st character of 1st choice
  247.       ans=menu(3,40)      ;four choices menu bar width 40
  248.       DO CASE
  249.       CASE ans=1
  250.          progname='MENUSAVE'
  251.          expnum=143
  252.          codnum=146
  253.       CASE ans=2
  254.          progname='MEMBERS'
  255.          expnum=106
  256.          codnum=8
  257.       CASE ans=3
  258.          progname='LAB_GEN'
  259.          expnum=151
  260.          codnum=28
  261.       ENDCASE
  262.       IF ans>0
  263.          PERFORM options
  264.       ENDIF
  265.    ENDCASE
  266. ENDDO
  267. *
  268. PROCEDURE options
  269.    DO WHILE t
  270.       WINDOW 6,35,22,77 double
  271.       TEXT
  272.    You have chosen program &progname.
  273.    Highlight option you want and press
  274.    ENTER, or press a number from 0-7
  275.    (zero through seven).
  276.  
  277.    0. Return to SAMPLES menu
  278.  
  279.    1. Run Program &progname
  280.    2. View Program Explanation
  281.    3. View Explanation of Info Code
  282.    4. Look at the Code in the Editor
  283.    5. Print Program Explanation
  284.    6. Print Explanation of Info Code
  285.    7. Print the Code
  286.       ENDTEXT
  287.       WINDOW
  288.       CURSOR 13,37
  289.       option=menu(7,40)
  290.       DO CASE
  291.       CASE option=0
  292.          BREAK
  293.       CASE option=1
  294.          CHAIN &progname
  295.       CASE option=2
  296.          COLOR :color,0,0,24,79,177  ;fill screen with pattern of character 177
  297.          @ 22,30 say ' Press spacebar . . . '
  298.          WINDOW 3,19  ;declare space for text
  299.          SET width to 80
  300.          TEXT .expnum
  301.          CURSOR 22,50
  302.          ok=inkey()
  303.       CASE option=3
  304.          COLOR :color,0,0,24,79,177  ;fill screen with pattern of character 177
  305.          @ 22,30 say ' Press spacebar . . . '
  306.          WINDOW 3,19  ;declare space for text
  307.          SET width to 80
  308.          TEXT .codnum
  309.          CURSOR 22,50
  310.          ok=inkey()
  311.       CASE option=4
  312.          WRITE &progname
  313.       CASE option=5
  314.          IF printer()
  315.             SET printer on
  316.             WINDOW
  317.             CLS
  318.             SET width to 80
  319.             TEXT .expnum
  320.             EJECT
  321.             SET print off
  322.          ENDIF
  323.       CASE option=6
  324.          IF printer()
  325.             SET printer on
  326.             WINDOW
  327.             CLS
  328.             SET width to 80
  329.             TEXT .codnum
  330.             EJECT
  331.             SET print off
  332.          ENDIF
  333.       CASE option=7
  334.          IF printer()
  335.             SPOOL &progname.prg to prn
  336.          ENDIF
  337.       ENDCASE
  338.    ENDDO
  339. ENDPROC options
  340. *
  341. *                         *** end of SAMPLES.PRG ***
  342.